<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of UserOrgModel
 *
 * @author wangnaixin
 */
namespace Admin\Model;
use Think\Model\RelationModel;
class UserOrgModel extends RelationModel {
    //put your code here
    protected $tableName = 'user_org'; 
    
    public function delByOrgId($orgId){
        return $this->where("org_id = ".$orgId)->delete();
    }
    
    public function addAdmins($orgId,$admins){
        $save = array();
        foreach ($admins as $v){
            $save[] = array(
                'user_id'=>$v,
                'org_id'=>$orgId
            );
        }
        
        return $this->addAll($save);
    }
    
}
